import sys
sys.path.append("..")
import tensor as T
from tensor import Tensor
import numpy as np
from time import time

A = Tensor((1,1,2,2))
K = Tensor((1,2,2))
feature = Tensor((1,1,1,1))

a = np.array(
	[[[
	[1.,1],
	[1,1]
	]]]
	)

k = np.array([
	[[1.,2],
	[3,4]]])

f = np.array([[[[1]]]])


A.inputValue(a)
K.inputValue(k)
feature.inputValue(f)




"""
#way 1:
out = A.simpleConv2d(kernels=K)
A.forward()
print(out)

#way 2:
out = A.simpleConv2d(kernelshape=K.shape)
A.forward()
print(out.shape)

"""

out = A.simpleConv2d(kernels=K)
A.forward()
loss = out.MSELoss(feature)
loss.backward()
print(A.grad)
print('=================')
print(K.grad)


